package com.ssy.lingxi.contract.model.constant;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 请款单动作枚举
 * @author ds
 * @date 2021/5/21
 * @version 2.0.0
 */
public enum ApplyAmountOrderActionEnum {

    /**
     * 全部 - 0
     */
    ALL(0, "全部"),
    /**
     * 新增请款单
     */
    ADD(1, "新增请款单"),
    /**
     * 提交审核
     */
    SUBMIT_VALIFY(2, "提交审核"),
    /**
     * 审核请款单(一级)
     */
    EXAMINE_STEP_1(3, "审核请款单(一级)"),
    /**
     * 审核请款单(二级)
     */
    EXAMINE_STEP_2(4, "审核请款单(二级)"),
    /**
     * 提交请款单
     */
    SUBMIT(5, "提交请款单"),
    /**
     * 作废
     */
    INVALID(6, "作废"),
    /**
     * 付款
     */
    PAY(7, "付款");

    private final Integer code;
    private final String message;

    ApplyAmountOrderActionEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getClass(), this.code);
    }

    public static String getMessage(Integer code) {
        ApplyAmountOrderActionEnum item = Arrays.stream(ApplyAmountOrderActionEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);

        return null != item ? item.getMessage() : "";
    }
}
